package com.shujia.scala

object Demo5Fun {
  def main(args: Array[String]): Unit = {

    val i: Int = jiecheng(5)
    println(i)

  }

  //阶乘,递归
  def jiecheng(i: Int): Int = {
    if (i == 1) {
      1
    } else {
      i * jiecheng(i - 1)
    }
  }


}
